package org.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author control
 */
@RestController
@RequestMapping("/stock")
public class StockController {

    @Value("${server.port}")
    private String port;

    @GetMapping("/getStock")
    public String testCustomer(){
        return "服务端口为："+port+"stock信息:";
    }

    /**
     *
     * @param token
     * @return
     * 测试：
     * - http://127.0.0.1:8080/stock/getGatWayStock
     * - 结果： 服务端口为：9081stock信息: Gatway的token信息为+222
     */
    @GetMapping("/getGatWayStock")
    public String getGatWayStock(@RequestHeader("token") String token){
        return "服务端口为："+port+"stock信息: Gatway的token信息为+"+token;
    }


}
